import React, { useState } from 'react';
import { getMovieHttp } from '../../../modules'
import Item from '../Item'

const Index = () => {
    const [movie, setMovie] = useState([])
    const getMovieHttpFn = async () => {
        let res = await getMovieHttp.getMovieTopHttp()
        setMovie(res.data.res)
    }
    React.useEffect(() => {
        getMovieHttpFn()
    }, [])
    
    const hot = movie.map(item => {
        return (<Item key={item._id} item={item} />)
    })
    return (
        <div>
            {hot}
        </div>
    );
}

export default Index;
